import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';

class InfoList extends HookWidget {
  final List<InfoItemOption> options;

  const InfoList(this.options, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: options
              .map((e) => e.title)
              .map(
                (e) => Container(
                  padding: const EdgeInsets.symmetric(
                    horizontal: 8,
                  ),
                  constraints: const BoxConstraints(minHeight: 44),
                  child: Center(child: Text(e)),
                ),
              )
              .toList(),
        ),
        Expanded(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: options
                .map(
                  (e) => Container(
                    constraints: const BoxConstraints(minHeight: 44),
                    padding: const EdgeInsets.only(right: 8),
                    child: Row(
                      mainAxisSize: MainAxisSize.max,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        Expanded(child: Text(e.content,textAlign: TextAlign.end,)),
                        if (e.suffix != null) e.suffix!
                      ],
                    ),
                  ),
                )
                .toList(),
          ),
        ),
      ],
    );
  }
}

class InfoItemOption {
  final String title;
  final String content;
  final Widget? suffix;

  InfoItemOption({required this.title, required this.content, this.suffix});
}
